import { Connection } from 'typeorm';
import {Category} from "./databases/mongo/book/category.entity";
import {Books} from "./databases/mongo/book/books.entity";
import {Message} from "./databases/mongo/tao/message.entity";

export const BookManagerProviders = [
  {
    provide: 'categoryModelToken',
    useFactory: (connection: Connection) => connection.getMongoRepository(Category),
    inject: ['MongoBookConnectionToken'],
  },
  {
    provide: 'booksModelToken',
    useFactory: (connection: Connection) => connection.getMongoRepository(Books),
    inject: ['MongoBookConnectionToken'],
  },
  {
    provide: 'messageModelToken',
    useFactory: (connection: Connection) => connection.getMongoRepository(Message),
    inject: ['MongoTaoConnectionToken'],
  },
];
